import LoginResponse from '../models/authorizations/login-response'
import HttpResponse from '../models/http-response'
import BaseService from './base-service'

/**
 * 身份认证相关接口
 */
class AuthorizationService extends BaseService {
  /**
   * 获取token
   * @param { Object } request { userName: string; password: string }
   * @returns { Promise<HttpResponse<LoginResponse>>}
   */
  login(request: {
    userName: string
    password: string
  }): Promise<HttpResponse<LoginResponse>> {
    return super.post<LoginResponse>('/api/v2/security-users/token', request)
  }
}

export default new AuthorizationService()
